<template>
  <div>
    <el-main>
        <img :src="item.url" :key="i" v-for="(item,i) in fileList" />
    </el-main>
  </div>
</template>
<script>

export default {
    data(){
        return {
          filePath:'img/emoji/',
          fileList:[]
        }
    },
    created() {
        this.getList();
    },
    methods:{
        getList(){
            const requireFiled = require.context('../../../public/img/emoji', true, /\.gif$/); //读取文件
            requireFiled.keys().forEach((fileName)=>{
                let name = fileName.replace(/^\.\//,'');
                let obj={
                    url:`${this.filePath}${name}`
                };
                this.fileList.push(obj);
            });
        }
    }
}
</script>
